<?php

namespace App\Transformers;


use App\Models\FsUserIm;
use League\Fractal\TransformerAbstract;

class FsUserImTransformer extends TransformerAbstract
{
    protected $availableIncludes = ['fsUser', 'im'];

    public function transform(FsUserIm $fsUserIm)
    {
        return [
            'im_id' => $fsUserIm->im_id,
            'fs_user_id' => $fsUserIm->fs_user_id,
            'created_at' => empty($fsUserIm->created_at)?'':$fsUserIm->created_at->toDateTimeString(),
            'updated_at' => empty($fsUserIm->updated_at)?'':$fsUserIm->updated_at->toDateTimeString(),
        ];
    }
    public function includeFsUser(FsUserIm $fsUserIm)
    {
        return $this->item($fsUserIm->fsUser, new FsUserTransformer());
    }

    public function includeIm(FsUserIm $fsUserIm)
    {
        return $this->item($fsUserIm->im, new ImTransformer());
    }

}